package com.framework.utils.code;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;

/**
 * 功能描述: 验证码识别
 *
 * @author ck
 * @date 2018/11/27 15:51
 */
public class Recognition {
	public static void main(String[] path) throws Exception {
		URL u = new URL("http://route.showapi.com/184-5?showapi_appid%3Dmyappid%26img_base64%3D%26typeId%3D34%26convert_to_jpg%3D0%26needMorePrecise%3D0%26showapi_sign%3Dmysecret");
		InputStream in = u.openStream();
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		try {
            byte[] buf = new byte[1024];
			int read = 0;
			while ((read = in .read(buf)) > 0) {
				out.write(buf, 0, read);
			}
		} finally {
			if ( in != null) {
				in .close();
			}
		}
        byte[] b = out.toByteArray();
		System.out.println(new String(b, StandardCharsets.UTF_8));
	}
}
